function fnLogin(){
	
	var username = $.trim($("#username").val());
	if (username == null || username == "") {		
		$("#login-email-msg").html("用户名不能为空!");
		return;
	}

	var password = $.trim($("#passwd").val());
	if (password == null || password == "") {
		$("#login-pass-msg").html("密码不能为空!");
		return;
	}
	
	$.post( URL.auth,
			{method:'login',
			 username:$("#username").val(),
		     password:$("#passwd").val()		
			},
			
			 function(data)	{  	    	
   	    		if(data[0]=='error'){
   	    			alert("账号或密码错误!");
   	    		}else{
   	    			if(data[1]=="yuangong"){
   	    				self.location="student.jsp";
   	    			}else if(data[1]=="kezhang"){
   	    				self.location="teacher.jsp";
   	    			}else{
   	    				self.location="student.jsp";
   	    			}   	    			
   	    		}
   				
       	 	}
		);
	
}

